<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
	
<ui:composition template="/pages/template/padrao.xhtml">
<ui:define name="principal">
	<f:view>
	<h:form style="align:center">
	
		<!-- Nova Console -->
		<p:panel header="Novo Console">
			<h:panelGrid >
				<h:outputLabel for="nome" value="Nome *" />
				<p:inputText id="nome" value="#{controlConsole.console.nome}" required="true" />
				
				<h:outputLabel for="ano" value="Ano" />
				<p:inputText id="ano" value="#{controlConsole.console.ano}" >
					<f:validateLength minimum="4" maximum="4" />
				</p:inputText>
			</h:panelGrid>
			<h:panelGroup>
				<p:commandButton value="Inserir" action="#{controlConsole.inserir}" update="@form"/>
			</h:panelGroup>
		</p:panel>		
		
		<h:messages />

		<!-- Lista de Consoles -->
			<p:dataTable id="dataTable" var="cons" value="#{controlConsole.listaConsoles}"  
                 paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15">  
				<f:facet name="header">
					<h:outputText value="Consoles" />
				</f:facet>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Nome" />
					</f:facet>
					<h:outputText value="#{cons.nome}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Ano" />
					</f:facet>
					<h:outputText value="#{cons.ano}" />
				</p:column>
				
				<p:column headerText="Opções" >
					<p:rowEditor  />
				</p:column>
			</p:dataTable>
		<h:outputLink value="#{facesContext.externalContext.requestContextPath}/pages/inicial.jsf" >
			<f:verbatim>Voltar</f:verbatim>
		</h:outputLink>
	</h:form>
	</f:view>
</ui:define>
</ui:composition>
</html>